package nl.saxion.saktiehuis.service;

import java.util.List;

import nl.saxion.saktiehuis.dao.ProductDao;
import nl.saxion.saktiehuis.model.Product;
import nl.saxion.saktiehuis.util.AbstractDao;
import nl.saxion.saktiehuis.util.AbstractServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProductServiceImpl extends AbstractServiceImpl<Product> implements
		ProductService {

	@Autowired
	private ProductDao productDao;

	@Override
	public AbstractDao<Product> getDao() {
		return productDao;
	}

	@Override
	public Product getProductById(int id) {
		return productDao.getProductById(id);
	}

	@Override
	public List<Product> getSelectie(String type) {
		if (type == null || "".equals(type)) {
			return productDao.getAlleProducten();
		} else {
			return productDao.getSelectie(type);
		}
	}

}
